package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class RegistrarOrden extends javax.swing.JFrame {
	private JPanel panOrden;
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JButton btnQuitarPed;
	private JScrollPane jScrollPane1;
	private JLabel jLabel5;
	private JLabel lblTotal;
	private JLabel jLabel8;
	private JLabel jLabel7;
	private JTextField txtNro;
	private JButton btnBuscar;
	private JButton btnNuevo;
	private JButton btnAceptar;
	private JTextField txtNombreCli;
	private JTextField txtCedula;
	private JLabel jLabel6;
	private JLabel jLabel4;
	private JSeparator jSeparator1;
	private JTable tblTabPedidos;
	private JButton btnSalir;
	private JButton btnAgregarPedido;
	private JTextField txtCantidad;
	private JComboBox cmbProductosOrden;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public RegistrarOrden() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setBackground(new java.awt.Color(0,0,0));
			getContentPane().setLayout(null);
			{
				panOrden = new JPanel();
				getContentPane().add(panOrden, "Center");
				panOrden.setLayout(null);
				panOrden.setBackground(new java.awt.Color(150,182,35));
				panOrden.setBounds(14, 79, 424, 339);
				{
					jLabel2 = new JLabel();
					panOrden.add(jLabel2);
					jLabel2.setText("Producto:");
					jLabel2.setBounds(15, 12, 92, 38);
					jLabel2.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					cmbProductosOrden = new JComboBox();
					panOrden.add(cmbProductosOrden);
					cmbProductosOrden.setBounds(102, 20, 219, 21);
				}
				{
					jLabel3 = new JLabel();
					panOrden.add(jLabel3);
					jLabel3.setText("Cantidad:");
					jLabel3.setBounds(14, 66, 95, 14);
					jLabel3.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtCantidad = new JTextField();
					panOrden.add(txtCantidad);
					txtCantidad.setBounds(102, 62, 60, 22);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					txtCantidad.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					btnAgregarPedido = new JButton();
					panOrden.add(btnAgregarPedido);
					btnAgregarPedido.setBounds(182, 47, 50, 48);
					btnAgregarPedido.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Agregar.jpg")));
					btnAgregarPedido.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnAgregarPedido.setOpaque(false);
					btnAgregarPedido.setActionCommand("AgregarPedido");
				}
				{
					btnQuitarPed = new JButton();
					panOrden.add(btnQuitarPed);
					btnQuitarPed.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Quitar.jpg")));
					btnQuitarPed.setOpaque(false);
					btnQuitarPed.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnQuitarPed.setBounds(280, 48, 53, 46);
					btnQuitarPed.setActionCommand("QuitarPedido");

				}
				{
					btnSalir = new JButton();
					panOrden.add(btnSalir);
					btnSalir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/salir.jpg")));
					btnSalir.setOpaque(false);
					btnSalir.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnSalir.setBounds(343, 266, 46, 39);
					btnSalir.setActionCommand("Salir");
				}
				{
					jScrollPane1 = new JScrollPane();
					panOrden.add(jScrollPane1);
					jScrollPane1.setBounds(15, 106, 379, 105);
					{
						tblTabPedidos = new JTable();
						jScrollPane1.setViewportView(tblTabPedidos);
						tblTabPedidos.setBounds(49, 200, 230, 32);
					}
				}
				{
					jSeparator1 = new JSeparator();
					panOrden.add(jSeparator1);
					jSeparator1.setBounds(13, 248, 258, 10);
				}
				{
					jLabel4 = new JLabel();
					panOrden.add(jLabel4);
					jLabel4.setText("Nombre:");
					jLabel4.setFont(new java.awt.Font("Purisa",0,14));
					jLabel4.setBounds(17, 277, 98, 38);
				}
				{
					jLabel5 = new JLabel();
					panOrden.add(jLabel5);
					jLabel5.setText("Cédula:");
					jLabel5.setFont(new java.awt.Font("Purisa",0,14));
					jLabel5.setBounds(19, 248, 109, 31);
				}
				{
					jLabel6 = new JLabel();
					panOrden.add(jLabel6);
					jLabel6.setText("DATOS DEL CLIENTE");
					jLabel6.setFont(new java.awt.Font("Purisa",0,14));
					jLabel6.setBounds(66, 222, 187, 31);
				}
				{
					txtCedula = new JTextField();
					panOrden.add(txtCedula);
					txtCedula.setBounds(81, 255, 101, 18);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					txtCedula.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					txtNombreCli = new JTextField();
					panOrden.add(txtNombreCli);
					txtNombreCli.setBounds(83, 287, 179, 18);
				}
				{
					btnAceptar = new JButton();
					panOrden.add(btnAceptar);
					btnAceptar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/aceptargreen.jpg")));
					btnAceptar.setActionCommand("Aceptar");
					btnAceptar.setOpaque(false);
					btnAceptar.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnAceptar.setBounds(286, 269, 39, 33);
				}
				{
					btnNuevo = new JButton();
					panOrden.add(btnNuevo);
					btnNuevo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Pedido.jpg")));
					btnNuevo.setActionCommand("Nuevo");
					btnNuevo.setOpaque(false);
					btnNuevo.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnNuevo.setBounds(355, 20, 39, 42);
				}
				{
					btnBuscar = new JButton();
					panOrden.add(btnBuscar);
					btnBuscar.setText("Buscar");
					btnBuscar.setActionCommand("Buscar");
					btnBuscar.setFont(new java.awt.Font("Purisa",0,10));
					btnBuscar.setBackground(new java.awt.Color(255,255,255));
					btnBuscar.setBounds(188, 253, 74, 20);
				}
				{
					txtNro = new JTextField();
					panOrden.add(txtNro);
					txtNro.setBounds(241, 63, 33, 21);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					txtNro.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					jLabel7 = new JLabel();
					panOrden.add(jLabel7);
					jLabel7.setText("Nro.");
					jLabel7.setFont(new java.awt.Font("Purisa",0,14));
					jLabel7.setBounds(244, 44, 38, 20);
				}
				{
					jLabel8 = new JLabel();
					panOrden.add(jLabel8);
					jLabel8.setText("Total:");
					jLabel8.setFont(new java.awt.Font("Purisa",0,14));
					jLabel8.setBounds(274, 211, 69, 25);
				}
				{
					lblTotal = new JLabel();
					panOrden.add(lblTotal);
					lblTotal.setBounds(330, 215, 60, 16);
				}
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("Orden");
				jLabel1.setBounds(32, 12, 239, 67);
				jLabel1.setForeground(new java.awt.Color(255,255,255));
				jLabel1.setFont(new java.awt.Font("Purisa",0,36));
				jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/pedidoBlack.jpg")));
			}
			pack();
			this.setSize(454, 467);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void addListener(ActionListener actionListener){
		this.btnAgregarPedido.addActionListener(actionListener);
		this.btnQuitarPed.addActionListener(actionListener);
		this.btnAceptar.addActionListener(actionListener);
		this.btnNuevo.addActionListener(actionListener);
		this.btnBuscar.addActionListener(actionListener);
		this.btnSalir.addActionListener(actionListener);
	}
	public void setCmbProductos(String[] cmbProductos){
		ComboBoxModel cmbProductosModel = new DefaultComboBoxModel(cmbProductos);
		this.cmbProductosOrden.setModel(cmbProductosModel);
	}
	public String getCmbProductos(){
		return this.cmbProductosOrden.getSelectedItem().toString();
	}
	public void setTxtCantidad(String valor){
		this.txtCantidad.setText(valor);
	}
	public String getTxtCantidad(){
		return this.txtCantidad.getText();
	}
	public void setCedula(String valor){
		this.txtCedula.setText(valor);
		}
	public String getCedula(){
		return this.txtCedula.getText();
	}
	public void setNombreCliente(String n){
		this.txtNombreCli.setText(n);
	}
	public String getNombreCliente(){
		return this.txtNombreCli.getText();
	}
	public void setTablaPedidos(AbstractTableModel abstractTableModel){
		this.tblTabPedidos.setModel(abstractTableModel);
	}
	public void mostratMensaje(String message){
		JOptionPane.showMessageDialog(this, message);
	}
	public void setNro(String valor){
		this.txtNro.setText(valor);
	}
	public String getNro(){
		return this.txtNro.getText();
	}
	public void setTotal(String valor){
		this.lblTotal.setText(valor);
	}
	public String getTotal(){
		return this.lblTotal.getText();
	}
}
